# 作者：我只是代码的搬运工
# coding:utf-8

from flask import Flask

from exts import db, Bootstrap, Moment
from sayhello.settings import DevelopmentConfig
from sayhello.views import say


def create_app():
    app = Flask('sayhello', template_folder='../templates', static_folder='../static')
    app.config.from_object(DevelopmentConfig)
    app.jinja_env.trim_blocks = True
    app.jinja_env.lstrip_blocks = True

    # 初始化db
    db.init_app(app=app)
    # 初始化bootstrap
    Bootstrap(app=app)
    # 初始化Moment
    Moment(app=app)
    # 注册蓝图
    app.register_blueprint(say)
    return app
